Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
synchro-prompt
Advanced tools
super simple synchronous cli prompt using readline-sync with chalk coloring
Wrapper around readline-sync with chalk coloring for synchronous cli prompting.
npm install synchro-prompt
var prompt = require('synchro-prompt');
var answer = prompt('Enter value: ');
// $ Enter Value: HELLO!
answer; // HELLO!
// or as an array
var answers = prompt(['Name: ', 'Age: ']);
// $ Name: Jane
// $ Age: Doe
answers instanceof Array; // true
answers; // ['Jane', 'Doe']
By default, the prompt coloring is yellow. This can be overriden
with any valid chalk
color (provided as string), along with an optional
transformation callback which can be used to format or validate input.
var options = {
color: 'magenta',
transform: function(input) {
return input.trim().toLowerCase();
}
};
prompt('Enter something: ', options);
// back to the default no-transform yellow
prompt('And again: ');
You can set the options from one point forward by passing the options hash as the first argument.
// prompt from here on will always use your options
prompt({
color: green,
transform: function(input) {
return Date.now() + '_' + input;
}
});
prompt('...'); // ie. 1426910954458_something
// but you can still override a single call
prompt('...', { transform: function(input) { return input; }});
// future calls without a second argument will go back to prepending a timestamp
// to restore the factory defaults, call the synchro-prompt fn with no arguments
prompt(); // yellow, no-transform
FAQs
super simple synchronous cli prompt using readline-sync with chalk coloring
The npm package synchro-prompt receives a total of 14 weekly downloads. As such, synchro-prompt popularity was classified as not popular.
We found that synchro-prompt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.